class Test1
{
public static void main(String arg[])
{
try
{
int a=Integer.parseInt(arg[0]);

int b=Integer.parseInt(arg[1]);

int c=a/b;
}

catch(ArithmeticException ae)
{
System.out.println("value of b is 0");
int b=1;
int a=2;
int c=a/b;
System.out.println("the value of c is :"+c);
System.out.println(ae);
}
catch(NumberFormatException e)
{
System.out.println("wrong input");
System.out.println(e);
}
catch(ArrayIndexOutOfBoundsException a1)
{
System.out.println("arguments are not passed");
System.out.println(a1);
}
finally
{
System.out.println("end of program");
}
}
}

/* OUTPUT */

C:\kajol>java Test1 1 0
value of b is 0
the value of c is :2
java.lang.ArithmeticException: / by zero
end of program

C:\kajol>java Test1
arguments are not passed
java.lang.ArrayIndexOutOfBoundsException: 0
end of program

C:\kajol>java Test1 5 a
wrong input
java.lang.NumberFormatException: For input string: "a"
end of program